<script>
import base from '../actionBase'
import {
    link
} from '@/common'
export default {
    extends: base,
    data() {
        return {
            submitMethod: 'POST'
        }
    },
    methods: {
        actionTrigger(id, data) {
            return new Promise((resolve) => {
                this.$Modal.confirm({
                    title: '确认操作',
                    content: '确认执行' + this.actionModel.name + '操作',
                    onOk: () => this.actionStart(id, data).then((res) => {
                        resolve(res)
                    })
                });
            })
        },
        actionStart(id, data) {
            return link(this.model.path, this.getSubmitData(), {
                method: this.submitMethod,
                param: data || this.getDataRow()
            }).then(() => {
                this.actionSuccess()
                //所有者更新数据
                this.$owner.update()
            })
        }
    }
}
</script>
